package com.project.service.impl;

import java.io.Serializable;
import java.util.List;

import com.project.dao.GenericDAO;
import com.project.service.GenericService;

/**
 * Generic Service Interface Implement.
 * 
 * @author travisl@synnex.com
 * 
 * @param <E>
 *            Entity
 * @param <P>
 *            Primary Key
 */
public abstract class GenericServiceImpl<E extends Serializable, P extends Serializable>
		implements GenericService<E, P> {

	protected GenericDAO<E, P> genericDAO;

	public abstract void setGenericDAO(GenericDAO<E, P> genericDAO);

	@Override
	public void save(E entity) {
		genericDAO.save(entity);
	}

	@Override
	public void saveOrUpdate(E entity) {
		genericDAO.saveOrUpdate(entity);
	}

	@Override
	public void update(E entity) {
		genericDAO.update(entity);
	}

	@Override
	public void delete(E entity) {
		genericDAO.delete(entity);
	}

	@Override
	public E get(P id) {
		return genericDAO.get(id);
	}

	@Override
	public List<E> listAll() {
		return genericDAO.listAll();
	}

}
